package com.jiuyue.movehouse.common.handler;

import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author min
 * @description
 * @date 2020/9/11
 */
@Data
@Accessors(chain = true)
public class R<T> implements Serializable {
    private int code;
    private String message;
    private T data;

    private R() {
        timestamp = LocalDateTime.now();
    }

    private LocalDateTime timestamp;

    public R(T data) {
        this();
        this.code = ResultCode.SUCCESS.getCode();
        this.message = ResultCode.SUCCESS.getMsg();
        this.data = data;
    }

    public R(ResultCode code) {
        this();
        this.code = code.getCode();
        this.message = code.getMsg();
    }

    public R(ResultCode code, T data) {
        this();
        this.code = code.getCode();
        this.message = code.getMsg();
        this.data = data;
    }




}
